<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/WEB-INF/struts-tags.tld"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<link id="favicon" href="/jxgl/favicon.ico" rel="icon"
	type="image/x-icon" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>所有学生</title>
<link rel="stylesheet" href="/jxgl/css/all.css" />
<link rel="stylesheet" href="/jxgl/css/login.css" />
<link rel="stylesheet" href="/jxgl/css/list.css" />
<script type="text/javascript" src="/jxgl/js/jquery-1.8.0.min.js"></script>
<script type="text/javascript">
	function gotoPage(pageid){
		$('#page_index_id').val(pageid);		
		$('#pageform').submit();
	}
	var states = ['未知','未付款','学车中','待审核','已通过'];
	function changeState(stuname,stuid,tostate,ele){
		if(confirm('确认学员'+stuname+$(ele).text()+'?')){
			$.ajax({
				url:'/jxgl/admin/stateChange',
				type:'POST',
				data:{
					'stuid':stuid,
					'to':tostate
				},
				dataType:'json',
				error: function(a,b,c){
					alert('服务器出错，请联系管理员');
				},
				complete:function(data,status){
					$('#pageform').submit();
				}
			});
		}
	}
</script>
</head>
<body id="lg_body">
	<div id="lg_wrap">
		<div id="ln_header">
			<div class="header_logo_bg">
				<div class="header_link">
					<a target="_blank"
						href="http://www.changdajx.cn/%E8%81%94%E7%B3%BB%E6%88%91%E4%BB%AC/"
						class="help_icon">问题咨询</a>&nbsp;&nbsp; <a target="_blank"
						href="http://www.changdajx.cn" class="home_icon">驾校首页</a>&nbsp;&nbsp;
				</div>
			</div>
		</div>
		<div class="main_link" style="width: 960px; margin-top: 3px;">
			<a href="/jxgl/login"><b>首页</b></a> &gt; <font color="#666666">管理员</font>
		</div>
		<div id="ln_main" style="height: 800px; width: 960px;">
			<div id="left-column">
				<div class="widget-alt">
					<div class="headline no-margin">
						<h4>管理工具箱</h4>
					</div>
					<ul class="links-list-alt" style="padding-left: 0px">
						<li><a href="/jxgl/admin/editPwd">修改密码</a></li>
						<li><a href="/jxgl/admin/newdriver.jsp">新建教练</a></li>
						<li><a href="/jxgl/admin/listdriver">教练列表</a></li>
						<li><a href="/jxgl/admin/liststudent">学员列表</a></li>
						<li><a href="/jxgl/logout">退出登录</a></li>
					</ul>
				</div>
			</div>
			<div id="center-column">
				<div class="headline no-margin">
					<h4>所有学生</h4>
				</div>
				<div id="dlist">
					<div class="driver-list">
						<div class="driver-common-title g-clear">
							<span class="left">统计学员</span>
							<div class="right">
								<form action="/jxgl/admin/liststudent" id="qform" method="post">
									<span> <select name="state">
											<option value="-1" <s:if test="state == -1">selected</s:if>>全部</option>
											<option value="0" <s:if test="state == 0">selected</s:if>>未选择教练</option>
											<option value="1" <s:if test="state == 1">selected</s:if>>未付款</option>
											<option value="2" <s:if test="state == 2">selected</s:if>>学车中</option>
											<option value="3" <s:if test="state == 3">selected</s:if>>待审核</option>
											<option value="4" <s:if test="state == 4">selected</s:if>>已通过</option>
									</select> <input type="text" name="q" id="qw"
										value="<s:property value="q" />" autocomplete="off"
										maxlength="50">
									</span> <input type="submit" value="搜索" /> <span class="list-title">搜索到<span><s:property
												value="total" /></span>个学生
									</span>
									<div class="clear"></div>
								</form>
							</div>
						</div>
						<div class="clear"></div>
						<div class="list g-clear">
							<table class="standard-table" style="margin-top: 30px;">
								<tr>
									<th>姓名</th>
									<th>电话</th>
									<th>注册时间</th>
									<th>学车类型</th>
									<th>教练</th>
									<th>当前状态</th>
									<th style="border-right: 1px solid #ddd;">操作</th>
								</tr>
								<s:iterator value="lds" id="s">
									<s:if test="#s.name != 'admin'">
										<tr>
											<td><s:property value="#s.realName" /></td>
											<td><s:property value="#s.phone" /></td>
											<td><s:date name="#s.regdate" format="yyyy-MM-dd" /></td>
											<td><s:if test="#s.carType == 0">手动</s:if> <s:if
													test="#s.carType == 1">自动</s:if></td>
											<td><s:if test="#s.driverId != -1">
													<a
														href="/jxgl/admin/viewDriver?driverid=<s:property value="#s.driverId" />"><s:property
															value="#s.driverName" /></a>
												</s:if> <s:else>未选择</s:else></td>
											<td><s:if test="#s.state == 0">未选择教练</s:if> <s:if
													test="#s.state == 1">未付款</s:if> <s:if test="#s.state == 2">学车中</s:if>
												<s:if test="#s.state == 3">待审核</s:if> <s:if
													test="#s.state == 4">已通过</s:if></td>
											<td style="border-right: 1px solid #ddd;"><a
												href="/jxgl/admin/viewStudent?studentid=<s:property value="#s.id" />">查看</a>
												<s:if test="#s.state == 3">
													<a href="javascript:void(0)"
														onclick="changeState('<s:property value="#s.realName" />','<s:property value="#s.id" />',4,this);return false;">审核通过</a>
												</s:if></td>
										</tr>
									</s:if>
								</s:iterator>
							</table>
						</div>
					</div>
				</div>
				<div class="pagination">
					<form action="/jxgl/admin/liststudent" id="pageform" method="post">
						<input type="hidden" name="q" value="<s:property value="q" />" />
						<input type="hidden" name="state"
							value="<s:property value="state" />" /> <input type="hidden"
							id="page_index_id" name="page_index"
							value="<s:property value="page_index" />" /><a href="javascript:gotoPage(1)"><li>&laquo;</li></a>
<a href="javascript:gotoPage(<s:property value="page_index - 1" />)"><li>&#8249;</li></a>

<s:if test="page_index != 1">
<a href="javascript:gotoPage(<s:property value="page_index - 1" />)"><li><s:property value="page_index - 1" /></li></a>
</s:if>
<a href="javascript:void();" class="cur"><li><s:property value="page_index" /></li></a>
<s:if test="page_index != page_count">
<a href="javascript:gotoPage(<s:property value="page_index + 1" />)"><li><s:property value="page_index + 1" /></li></a>
</s:if>

<a href="javascript:gotoPage(<s:property value="page_index + 1" />)"><li>&#8250;</li></a>
<a href="javascript:gotoPage(<s:property value="page_count" />)"><li>&raquo;</li></a>
						<form>
				</div>
			</div>
		</div>

	</div>
</body>
</html>